﻿<div class="well with-header" ng-controller="PinManageController">
    <div class="header bg-themeprimary">
        Token
        <div class="btn-group pull-right">
            <span class="btn btn-sm" style="margin-right:10px;" ng-click="popup('','FormPinTransferModal','PinTransferModalInstanceCtrl','sm')"><i class="fa fa-exchange"></i> Transfer Pin</span>
            <!--<span class="btn btn-sm" ng-click="popup('','FormAddPinModal','PinAddModalInstanceCtrl','sm')"><i class="fa fa-plus-circle"></i> Add Pin</span>-->
        </div>
    </div>
    <div class="widget-body">
        <div class="widget-main ">
            <tabset justified="true">
                <tab heading="Pin Manage">
                    <div class="row">
                        <div class="col-sm-12">
                            <table class="table table-bordered table-striped table-condensed flip-content">
                                <thead class="flip-content bordered-palegreen">
                                    <tr>
                                        <th>#</th>
                                        <th>Pin Code</th>
                                        <th>Date</th>
                                        <th width="1%">Used</th>
                                        <th width="10%">Use For</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-show="ListCard.length > 0" ng-repeat="data in ListCard.slice(((currentPage-1)*itemsPerPage), ((currentPage)*itemsPerPage))">
                                        <td class="numeric">{{$index+1}}</td>
                                        <td>{{data.PinCode}}</td>
                                        <td class="numeric">{{data.DataCreate}}</td>
                                        <td class="text-align-center">
                                            <i class="fa fa-recycle text-danger" title="is Used" ng-if="data.Used"></i>
                                            <i class="fa fa-check-circle text-success" title="not Used" ng-if="!data.Used"></i>
                                        </td>
                                        <td>{{data.UsedType}}</td>
                                    </tr>
                                </tbody>
                            </table>
                            <div class="pull-right">
                                <ul uib-pagination total-items="totalItems" ng-model="currentPage" max-size="maxSize" class="pagination-sm" boundary-link-numbers="true" items-per-page="itemsPerPage"></ul>
                            </div>
                        </div>
                    </div>
                </tab>
                <tab heading="History">
                    <div class="row">
                        <div class="col-sm-12">
                            <table class="table table-bordered table-striped table-condensed flip-content">
                                <thead class="flip-content bordered-palegreen">
                                    <tr>
                                        <th>#</th>
                                        <th>Amount</th>
                                        <th>Date</th>
                                        <th>Code</th>
                                        <th>User Send/Recieve</th>
                                        <th width="1%">Send/Recieve</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-show="ListHistory.length > 0" ng-repeat="data in ListHistory.slice(((current-1)*PerPage), ((current)*PerPage))">
                                        <td class="numeric">{{$index+1}}</td>
                                        <td>{{data.Amount}}</td>
                                        <td>{{data.CreateDate}}</td>
                                        <td>{{Code}}</td>
                                        <td>{{data.UserNameConfirm}}</td>
                                        <td class="text-align-center">
                                            {{data.SendOrRecieve}}
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <div class="pull-right">
                                <ul uib-pagination total-items="total" ng-model="current" max-size="maxPin" class="pagination-sm" boundary-link-numbers="true" items-per-page="PerPage"></ul>
                            </div>
                        </div>
                    </div>
                </tab>
            </tabset>
        </div>
    </div>
    <script type="text/ng-template" id="FormAddPinModal">
        <div class="modal-header">
            <strong>Add Pin</strong>
        </div>
        <div class="modal-body">

            <alert type="{{AlertType}}" class="radius-bordered alert-shadowed" ng-if="messeger">
                {{messeger}}
            </alert>

            <div class="loginbox">
                <form name="simpleForm" method="post" class="bv-form" novalidate="novalidate">
                    <div class="form-group">
                        <label>How many PIN you wish to buy?</label>
                        <input class="form-control" ng-model="data.Quantum" placeholder="Quantum" type="text" ng-change="doTotal(data.Quantum)">
                    </div>
                    {{data.PaymentId=2;""}}
                    <div class="form-group">
                        <label>
                            <strong>Total: </strong> <i class="fa fa-bitcoin"></i> {{total/BitcoinRate|number:8}} = <i class="fa fa-usd"></i> <span ng-bind="total"></span> | 1 Pin = <i class="fa fa-usd"></i> {{Rate.Value|number:2}}
                        </label>
                    </div>
                    {{data.totalBtc = total/BitcoinRate|number:8 }}
                </form>
            </div>
        </div>
        <div class="modal-footer">
            <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
            <button type="button" class="btn btn-success" ng-click="doAddPin(data)" ng-disabled="processing">Add Pin Now</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
        </div>
    </script>
</div>
<script type="text/ng-template" id="FormPinTransferModal">
    <div class="modal-header">
        <strong>Transfer Pin</strong>
    </div>
    <div class="modal-body">
        <div class="loginbox">
            <p class="text-danger">{{messeger}}</p>
            <form name="simpleForm" method="post" class="bv-form" novalidate="novalidate">
                <div class="form-group">
                    <label>Select recipient</label>
                    <ui-select ng-model="ddluser.selected">
                        <ui-select-match placeholder="Select user...">
                            {{$select.selected.UserName}}
                        </ui-select-match>
                        <ui-select-choices repeat="item in ListUser | filter: $select.search">
                            <span ng-bind="item.UserName"></span>
                        </ui-select-choices>
                    </ui-select>
                    {{data.UserId = ddluser.selected.Id;""}}
                </div>
                <div class="form-group">
                    <label>Quantum</label>
                    <input class="form-control" ng-model="data.Quantum" placeholder="Quantum" type="number">
                </div>
                <div class="form-group">
                    <label>Password level 2</label>
                    <input class="form-control" ng-model="data.Password2" placeholder="Password 2" type="password">
                </div>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
        <button type="button" class="btn btn-success" ng-click="doTransfer(data)" ng-disabled="processing">Submit</button>
        <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
    </div>
</script>
